package com.sj.compiler.test;

import com.sj.proxy.*;

public class Client {

    public static void main(String[] args) throws Exception {

//        IMoveable moveable = (IMoveable) Proxy1.newProxyInstance(IMoveable.class);
//        moveable.move();
        //
        Tank t = new Tank();    //被代理对象
        InvocationHandler h = new TimeHandler(t);   //代理逻辑，这里是记录时间的逻辑

//        IMoveable m2 = (IMoveable) Proxy.newProxyInstance(IMoveable.class, h);
//        m2.move();

        System.out.println(t);
        Object m2 = Proxy.newProxyInstance(IMoveable.class, h);
        System.out.println(m2);
        IMoveable m22 = (IMoveable) m2;
        System.out.println(m2);
        System.out.println(m22);

    }
}
